January 4, 2022 11:25 PM
282 VIEWS
class Solution { public: bool areOccurrencesEqual(string s) { map<char,int> mp; for(int i=0;i<s.size();i++)mp[s[i]]++; int cnt= mp[s[0]]; for(auto it : mp){ if(cnt!=it.second) return false; } return true; } };